# Contributor: Newbyte <newbie13xd@gmail.com>
# Maintainer: Newbyte <newbie13xd@gmail.com>
pkgname=amberol
pkgver=0.10.3
pkgrel=1
pkgdesc="Plays music, and nothing else"
url="https://gitlab.gnome.org/World/amberol"
# s390x fails to build
# riscv64: rust broken
arch="all !s390x !riscv64"
license="GPL-3.0-or-later"
depends="
	gst-libav
	gst-plugins-bad
	gst-plugins-good
	"
makedepends="
	cargo
	dbus-dev
	desktop-file-utils
	gmp-dev
	gst-plugins-bad-dev
	gst-plugins-base-dev
	gstreamer-dev
	libadwaita-dev
	m4
	meson
	mpfr-dev
	"
subpackages="$pkgname-lang"
source="
	https://gitlab.gnome.org/World/amberol/-/archive/$pkgver/amberol-$pkgver.tar.gz
	appdata.patch
	no-cargo-home.patch
	getrandom-0.2.10.patch
	"
options="net" # needed for downloading dependencies

export CARGO_FEATURE_USE_SYSTEM_LIBS=1 # gmp-mpfr-sys links to gmp-dev and mpfr-dev

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	# without buildtype=release it builds debug
	abuild-meson \
		--buildtype=release \
		. output
	meson compile -C output
}

check() {
	meson test --no-rebuild --print-errorlogs -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

sha512sums="
12684a222e06d0abbab03f6196021c262416ca9ed48526dd5343432a314c2615866ad6b97032c45d93003bb198a2bc90cb23baaf7debe3d3581cb3fd925021cf  amberol-0.10.3.tar.gz
b91753b665fdf4ec25ce23d7b827130e310edc8e0e4779244956f57c49db34c4ad0c1c03c868285a92bda69dcdf019d7f884953095ab575729e34a6d0cb50a1b  appdata.patch
2c4b7433f27b18bbb428bdc2053cda53f10e958a2045499ab7af6102df9610822cf36a82636cd5b9501ba4e204aeddc18fcdb79aff773657a9a5a3c1aeba8e95  no-cargo-home.patch
011e1850b351f025257743f6e897bfb9a05e59973ca077f990d58a2d3ba3d162505cf3f3948da44fd5d6a94482a5efca375d072c462c7a7cfca196e39b14f802  getrandom-0.2.10.patch
"
